package com.apes.fico.masterdata.gl.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @program: apestech
 * @description: 科目体系
 * @author: Chengxm
 * @create: 2018-12-20 11:07
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = AccountingSystem.CONST_TABLE_NAME)
public class AccountingSystem extends Model {
    public final static String CONST_TABLE_NAME = "mas_acc_chart_system";

    @Id
    @Column(name = "id", length = 8)
    @Comment("科目体系编码")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "科目体系")
    private String id;

    @Comment("科目体系名称")
    @Column(name = "name", nullable = false, length = 64)
    private String name;

    @Comment("描叙")
    @Column(name = "description", nullable = false, length = 200)
    private String description;

    @Comment("科目编码规则")
    @Column(name = "acc_id_rule ", nullable = false, length = 64)
    private String accIdRule;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null) return false;
        if (!(o instanceof AccountingSystem)) return false;
        AccountingSystem that = (AccountingSystem) o;
        return id.equals(that.getId());
    }

}
